// ABP 8.3.4 角色管理类型定义

import type { AbpPagedParams, AbpPagedResult } from '../types';

// 角色DTO
export interface RoleDto {
  id: string;
  name: string;
  normalizedName: string;
  isDefault: boolean;
  isStatic: boolean;
  isPublic: boolean;
  concurrencyStamp: string;
  extraProperties?: Record<string, any>;
}

// 角色创建DTO
export interface CreateRoleDto {
  name: string;
  isDefault?: boolean;
}

// 角色更新DTO
export interface UpdateRoleDto {
  name: string;
  isDefault?: boolean;
  concurrencyStamp: string;
}

// 角色请求参数
export interface GetRolesInput extends AbpPagedParams {
  filter?: string;
}

// 角色列表响应
export type GetRolesOutput = AbpPagedResult<RoleDto>;

// 权限DTO
export interface PermissionDto {
  name: string;
  displayName: string;
  parentName?: string;
  isGranted: boolean;
}

// 权限组DTO
export interface PermissionGroupDto {
  name: string;
  displayName: string;
  displayNameKey: string;
  permissions: PermissionDto[];
}

// 获取权限响应
export interface GetPermissionsOutput {
  entityDisplayName: string;
  groups: PermissionGroupDto[];
}

// 更新权限请求
export interface UpdatePermissionsDto {
  permissions: Array<{
    name: string;
    isGranted: boolean;
  }>;
}
